<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>windows 对象</title>
    <style>
        .clock{
            width: 400px;
            height: 200px;
            border: 1px solid red;
        }
        #input{
            margin: 10px 98px;
            width: 200px;
            height: 50px;
            text-align: center;
        }
        .clock-btu{
            margin: 0px 130px;
            word-spacing: 33px;
        }

    </style>
</head>
<body>
<div class="clock">
    <input type="text" id ='input' ><br>
    <div class="clock-btu">
        <button onclick="begin()">开始</button>
        <button onclick="end()">停止</button><br>
    </div>
</div>



<script>
    //    -----------------------windows 对象--------------------------------------
    //   1. window.alert
    window.alert('消息警告框');
    //   2. window.confirm
    var ret=window.confirm("消息警告框,带有确定、取消 按钮的对话框");
    console.log(ret);
    //   3. window.prompt
    var ret1=window.prompt("带有输入框 确定、取消 按钮的对话框");
    console.log(ret1);
    //   4. window.open()
        //    window.open('http://www.cnblogs.com/haiyan123/p/7598320.html')
    //   5. window.close()
        //    window.close('www.baidu.com')

//     -------------------------时间显示器setTimeout/clearTimeout------------------------------------
        function f() {
            console.log('hello world!!!!!!!!!!!11')
        }

        var s1=setTimeout(f,1000);
        clearTimeout(s1)


    //    -------------------------时间显示器setIntervial/clearInterval------------------------------------
    var date0=new Date();
    console.log(date0);
    var date1= date0.toLocaleString();
    console.log(date1);
    function showtime(){
        var date=new Date().toLocaleString();
        console.log(date.toLocaleString());
        var input=document.getElementById("input");
        input.value=date;
        console.log(input)
    }
    var ID;
    function begin(){
        if(ID==undefined){
            showtime();
            ID=setInterval(showtime,1000)
        }
    }
    function end() {
        clearInterval(ID);
        console.log(ID);
        ID = undefined

    }














</script>
</body>
</html>